﻿#region Copyright (c) Koolwired Solutions, LLC.
/*--------------------------------------------------------------------------
 * Copyright (c) 2010, Koolwired Solutions, LLC.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer. 
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution. 
 * Neither the name of Koolwired Solutions, LLC. nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission. 
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
 * AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
 * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *--------------------------------------------------------------------------*/
#endregion

#region History
/*--------------------------------------------------------------------------
 * Modification History: 
 * Date       Programmer      		Description
 * 10/19/10   Keith Kikta     		Inital release.
 *--------------------------------------------------------------------------*/
#endregion

#region References
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
#endregion

namespace Koolwired.Imap.Test
{
    [TestClass]
    public class ImapBodyPartTest
    {
        static List<string> parts = new List<string>();

        [ClassInitialize]
        public static void Init(TestContext context)
        {
            /*
             * ("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 935 38 NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "us-ascii") NIL NIL "QUOTED-PRINTABLE" 2788 63 NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "----=_NextPart_000_0026_01C61126.92B20ED0") NIL NIL
             * ("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 1464 58 NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "us-ascii") NIL NIL "QUOTED-PRINTABLE" 4252 93 NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "----=_NextPart_000_002E_01C61127.9C0C5B10") NIL NIL
             * ("TEXT" "PLAIN" ("CHARSET" "ISO-8859-1") NIL NIL "QUOTED-PRINTABLE" 368 10 NIL ("INLINE" NIL) NIL)("TEXT" "HTML" ("CHARSET" "ISO-8859-1") NIL NIL "QUOTED-PRINTABLE" 487 15 NIL ("INLINE" NIL) NIL) "ALTERNATIVE" ("BOUNDARY" "----=_Part_52007_27528544.1136475446009") NIL NIL
             * "TEXT" "PLAIN" ("CHARSET" "iso-8859-1") NIL NIL "7BIT" 667 18 NIL NIL NIL
             * ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 209 5 NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "US-ASCII") NIL NIL "QUOTED-PRINTABLE" 664 23 NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "----=_NextPart_000_0023_01C614F9.4B4F2C90") NIL NIL
             * ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 755 27 NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "US-ASCII") NIL NIL "QUOTED-PRINTABLE" 1738 39 NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "----=_NextPart_000_0050_01C61509.A56FBBD0") NIL NIL
             * ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 54 1 NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "US-ASCII") NIL NIL "QUOTED-PRINTABLE" 565 20 NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "----=_NextPart_000_0064_01C6151B.418CBAC0") NIL NIL
             * ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 495 20 NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "US-ASCII") NIL NIL "QUOTED-PRINTABLE" 1551 35 NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "----=_NextPart_000_006C_01C61520.CCBA3550") NIL NIL
             * ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 90 2 NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "US-ASCII") NIL NIL "QUOTED-PRINTABLE" 490 18 NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "----=_NextPart_000_0084_01C61531.A577CAF0") NIL NIL
             * ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 509 20 NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "US-ASCII") NIL NIL "QUOTED-PRINTABLE" 1453 33 NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "----=_NextPart_000_0093_01C6153C.0D5B8300") NIL NIL
             * (("TEXT" "PLAIN" ("CHARSET" "iso-8859-1") NIL NIL "8BIT" 190 11 NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "iso-8859-1") NIL NIL "8BIT" 468 5 NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "0-1650433767-1132434953=:5572") NIL NIL)("APPLICATION" "X-ZIP-COMPRESSED" ("NAME" "Sr Project.zip") NIL "841298131-Sr Project.zip" "BASE64" 8524721 NIL ("ATTACHMENT" ("FILENAME" "Sr Project.zip")) NIL) "MIXED" ("BOUNDARY" "0-1648419439-1132434953=:5572") NIL NIL
             * */
            parts.Add("(\"TEXT\" \"PLAIN\" (\"CHARSET\" \"us-ascii\") NIL NIL \"7BIT\" 935 38 NIL NIL NIL)(\"TEXT\" \"HTML\" (\"CHARSET\" \"us-ascii\") NIL NIL \"QUOTED-PRINTABLE\" 2788 63 NIL NIL NIL) \"ALTERNATIVE\" (\"BOUNDARY\" \"----=_NextPart_000_0026_01C61126.92B20ED0\") NIL NIL");
            parts.Add("(\"TEXT\" \"PLAIN\" (\"CHARSET\" \"us-ascii\") NIL NIL \"7BIT\" 1464 58 NIL NIL NIL)(\"TEXT\" \"HTML\" (\"CHARSET\" \"us-ascii\") NIL NIL \"QUOTED-PRINTABLE\" 4252 93 NIL NIL NIL) \"ALTERNATIVE\" (\"BOUNDARY\" \"----=_NextPart_000_002E_01C61127.9C0C5B10\") NIL NIL");
            parts.Add("(\"TEXT\" \"PLAIN\" (\"CHARSET\" \"ISO-8859-1\") NIL NIL \"QUOTED-PRINTABLE\" 368 10 NIL (\"INLINE\" NIL) NIL)(\"TEXT\" \"HTML\" (\"CHARSET\" \"ISO-8859-1\") NIL NIL \"QUOTED-PRINTABLE\" 487 15 NIL (\"INLINE\" NIL) NIL) \"ALTERNATIVE\" (\"BOUNDARY\" \"----=_Part_52007_27528544.1136475446009\") NIL NIL");
            parts.Add("\"TEXT\" \"PLAIN\" (\"CHARSET\" \"iso-8859-1\") NIL NIL \"7BIT\" 667 18 NIL NIL NIL");
            parts.Add("(\"TEXT\" \"PLAIN\" (\"CHARSET\" \"US-ASCII\") NIL NIL \"7BIT\" 209 5 NIL NIL NIL)(\"TEXT\" \"HTML\" (\"CHARSET\" \"US-ASCII\") NIL NIL \"QUOTED-PRINTABLE\" 664 23 NIL NIL NIL) \"ALTERNATIVE\" (\"BOUNDARY\" \"----=_NextPart_000_0023_01C614F9.4B4F2C90\") NIL NIL");
            parts.Add("(\"TEXT\" \"PLAIN\" (\"CHARSET\" \"US-ASCII\") NIL NIL \"7BIT\" 755 27 NIL NIL NIL)(\"TEXT\" \"HTML\" (\"CHARSET\" \"US-ASCII\") NIL NIL \"QUOTED-PRINTABLE\" 1738 39 NIL NIL NIL) \"ALTERNATIVE\" (\"BOUNDARY\" \"----=_NextPart_000_0050_01C61509.A56FBBD0\") NIL NIL");
            parts.Add("(\"TEXT\" \"PLAIN\" (\"CHARSET\" \"US-ASCII\") NIL NIL \"7BIT\" 54 1 NIL NIL NIL)(\"TEXT\" \"HTML\" (\"CHARSET\" \"US-ASCII\") NIL NIL \"QUOTED-PRINTABLE\" 565 20 NIL NIL NIL) \"ALTERNATIVE\" (\"BOUNDARY\" \"----=_NextPart_000_0064_01C6151B.418CBAC0\") NIL NIL");
            parts.Add("(\"TEXT\" \"PLAIN\" (\"CHARSET\" \"US-ASCII\") NIL NIL \"7BIT\" 495 20 NIL NIL NIL)(\"TEXT\" \"HTML\" (\"CHARSET\" \"US-ASCII\") NIL NIL \"QUOTED-PRINTABLE\" 1551 35 NIL NIL NIL) \"ALTERNATIVE\" (\"BOUNDARY\" \"----=_NextPart_000_006C_01C61520.CCBA3550\") NIL NIL");
            parts.Add("(\"TEXT\" \"PLAIN\" (\"CHARSET\" \"US-ASCII\") NIL NIL \"7BIT\" 90 2 NIL NIL NIL)(\"TEXT\" \"HTML\" (\"CHARSET\" \"US-ASCII\") NIL NIL \"QUOTED-PRINTABLE\" 490 18 NIL NIL NIL) \"ALTERNATIVE\" (\"BOUNDARY\" \"----=_NextPart_000_0084_01C61531.A577CAF0\") NIL NIL");
            parts.Add("(\"TEXT\" \"PLAIN\" (\"CHARSET\" \"US-ASCII\") NIL NIL \"7BIT\" 509 20 NIL NIL NIL)(\"TEXT\" \"HTML\" (\"CHARSET\" \"US-ASCII\") NIL NIL \"QUOTED-PRINTABLE\" 1453 33 NIL NIL NIL) \"ALTERNATIVE\" (\"BOUNDARY\" \"----=_NextPart_000_0093_01C6153C.0D5B8300\") NIL NIL");
            parts.Add("((\"TEXT\" \"PLAIN\" (\"CHARSET\" \"iso-8859-1\") NIL NIL \"8BIT\" 190 11 NIL NIL NIL)(\"TEXT\" \"HTML\" (\"CHARSET\" \"iso-8859-1\") NIL NIL \"8BIT\" 468 5 NIL NIL NIL) \"ALTERNATIVE\" (\"BOUNDARY\" \"0-1650433767-1132434953=:5572\") NIL NIL)(\"APPLICATION\" \"X-ZIP-COMPRESSED\" (\"NAME\" \"Sr Project.zip\") NIL \"841298131-Sr Project.zip\" \"BASE64\" 8524721 NIL (\"ATTACHMENT\" (\"FILENAME\" \"Sr Project.zip\")) NIL) \"MIXED\" (\"BOUNDARY\" \"0-1648419439-1132434953=:5572\") NIL NIL");
            parts.Add("((\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL \"7bit\" 142 16 NIL NIL NIL NIL)(\"text\" \"html\" (\"charset\" \"us-ascii\") NIL NIL \"quoted-printable\" 2890 99 NIL NIL NIL NIL) \"alternative\" (\"boundary\" \"----=_NextPart_001_0002_01C6E740.CBFCBFA0\") NIL NIL NIL)(\"application\" \"vnd.ms-excel\" (\"name\" \"SDR3 - Smart Template.xls\") NIL NIL \"base64\" 21722 NIL (\"attachment\" (\"filename\" \"SDR3 - Smart Template.xls\")) NIL NIL)(\"application\" \"msword\" (\"name\" \"About Keith Kikta - Floyd Imaging Project.doc\") NIL NIL \"base64\" 31530 NIL (\"attachment\" (\"filename\" \"About Keith Kikta - Floyd Imaging Project.doc\")) NIL NIL) \"mixed\" (\"boundary\" \"----=_NextPart_000_0001_01C6E740.CBFCBFA0\") NIL NIL NIL");
        }
        [TestMethod]
        public void DisconnectedBodyStructureTest()
        {
            var items = new List<ImapBodyPart>();
            foreach (string part in parts)
                items.Add(new ImapBodyPart(part));
        }
    }
}
